//
//  AlertManager.swift
//  SwiftuiUno
//
//  Created by hccc on 2023/11/22.
//

import Foundation
import AlertToast
import SwiftUI


@MainActor
class ToastManager: BaseLogic {
    static let shared = ToastManager()
    
    @Published var show = false
    @Published var toast = AlertToast(type: .regular, title: "SOME TITLE") {
        didSet {
            show.toggle()
        }
    }
    
    /// 展示文本
    /// - Parameter text: text
    static func show(text: String) {
        shared.toast = AlertToast(
            displayMode: .alert,
            type: .regular,
            title: text,
            subTitle: nil,
            style: .style(
                backgroundColor: Theme.color.textfieldBackgroundColor,
                titleColor: .white,
                subTitleColor: .white,
                titleFont: .system(size: 18),
                subTitleFont: .system(size: 14)
            )
        )
    }
}
